<template>
    <div class="ykList">
        <div class="topBanner">
            <img class="bannerIcon" src="@/assets/yk/bannerIcon.png" />
            <div class="info">
                <img class="headPhoto" src="@/assets/yk/headPhoto.png" />
                <div class="infoDetail">
                    <div>{{ info.agentName }}</div>
                    <div style="color: #66d6ff; display: flex; align-items: center">
                        <img class="tag" src="@/assets/yk/tag.png" />
                        {{ info.agentNo }}
                    </div>
                </div>
            </div>
        </div>
        <div class="list">
            <div class="listTit">
                <div class="lineIcon"></div>
                我发展的盈客
            </div>
            <div class="listCard" v-if="ykList.length !== 0">
                <div class="cardItem" v-for="item in ykList" :key="item.number">
                    <div class="cartTit">
                        <div class="titTag">NO.0{{ item.number }}</div>
                        {{ item.agentName }}
                    </div>
                    <div class="cardContent">
                        <img class="ykUser" src="@/assets/yk/ykUser.png" />
                        <div>
                            <div class="row">
                                <img class="tag" src="@/assets/yk/tagNum.png" />
                                盈客编号：{{ item.agentNo }}
                            </div>
                            <div class="row">
                                <img class="tag" src="@/assets/yk/havDev.png" />
                                已发展盈客：
                                <span style="color: #0047f9">{{ item.developNumber }}人</span>
                            </div>
                            <div class="row monthTrade">本月交易：￥{{ item.transAomunt }}</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="shareModel">
            <div class="shareBox">
                <div class="shareContent" @click="onShare">
                    <div class="left">
                        <div class="row">
                            分享我的盈客二维码
                            <img class="goNext" src="@/assets/yk/goNext.png" />
                        </div>
                        <div class="row1">发展我的盈客</div>
                    </div>
                    <img class="right" src="@/assets/yk/code.png" />
                </div>
            </div>
        </div>
    </div>
</template>

<script setup>
import { agentFindByAgentNo } from '@/api/agent'
import { findByPageAll } from '@/api/ykshare'
import { useRouter, useRoute } from 'vue-router'
const router = useRouter()
const route = useRoute()
const info = ref({})
const ykList = ref([])
const onShare = () => {
    console.log(route.query)
    router.push({
        path: '/shareYk',
        query: {
            inviterCode: route.query.inviterCode,
            agentName: info.value.agentName
        }
    })
}
const getInfo = () => {
    agentFindByAgentNo({}).then(res => {
        info.value = res.object.agentBean
    })
}
const getfindByPageAll = () => {
    findByPageAll().then(res => {
        ykList.value = res.object.list
    })
}
getInfo()
getfindByPageAll()
</script>
<style scoped lang="scss">
.topBanner {
    position: relative;
    height: 100px;
    background: url('@/assets/yk/ykBanner.png') no-repeat top left / 100% 100%;
    .bannerIcon {
        position: absolute;
        right: 0;
        width: 80px;
        height: 80px;
    }
    .info {
        position: absolute;
        bottom: 0;
        display: flex;
        margin-left: 24px;
        transform: translateY(50%);
        .headPhoto {
            width: 68px;
            height: 68px;
        }
        .infoDetail {
            display: flex;
            flex-direction: column;
            justify-content: space-around;
            height: 68px;
            margin-left: 8px;
            color: #ffffff;
            .tag {
                width: 12px;
                height: 12px;
                margin-right: 5px;
            }
        }
    }
}
.list {
    margin-top: 50px;
    padding: 0 15px;
    .listTit {
        display: flex;
        align-items: center;
        font-size: 16px;
        font-family: SimHei;
        font-weight: 400;
        color: #000000;
        .lineIcon {
            width: 4px;
            height: 18px;
            background: #66d6ff;
            opacity: 1;
            border-radius: 0px;
            margin-right: 6px;
        }
    }
    .listCard {
        margin-top: 14px;
        .cardItem {
            padding: 0px 10px;
            background: #ffffff;
            opacity: 1;
            border-radius: 10px;
            margin-bottom: 15px;
            .cartTit {
                display: flex;
                align-items: center;
                padding: 7px 0;
                border-bottom: 1px solid #e4e4e4;
                .titTag {
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    font-size: 12px;
                    font-family: SimHei;
                    font-weight: 400;
                    color: #ffffff;
                    width: 44px;
                    height: 23px;
                    background: url('@/assets/yk/titTag.png') no-repeat top left / 100% 100%;
                    margin-right: 10px;
                }
            }
            .cardContent {
                display: flex;
                align-items: center;
                padding: 12px 5px;
                font-size: 13px;
                font-family: SimHei;
                font-weight: 400;
                color: #545454;
                .ykUser {
                    width: 36px;
                    height: 36px;
                    margin-right: 12px;
                }
                .row {
                    display: flex;
                    align-items: center;
                    margin-bottom: 12px;
                    .tag {
                        width: 12px;
                        height: 12px;
                        margin-right: 8px;
                    }
                }
                .monthTrade {
                    display: inline-block;
                    padding: 5px 8px;
                    background: #e7f0ff;
                    opacity: 1;
                    border-radius: 13px;
                    font-size: 14px;
                    font-family: Microsoft YaHei;
                    font-weight: 400;
                    color: #1e72fc;
                }
                .row:last-of-type {
                    margin-bottom: 0px;
                }
            }
        }
    }
}
.shareModel {
    padding: 0 15px;
    margin-top: 10px;
    .shareBox {
        background: #ffffff;
        opacity: 1;
        border-radius: 10px;
        padding: 6px;
        .shareContent {
            display: flex;
            justify-content: space-around;
            align-items: center;
            padding: 13px;
            background: #e4efff;
            border: 2px solid #9eb7ff;
            opacity: 1;
            border-radius: 10px;
            .left {
                .row {
                    font-size: 16px;
                    font-family: Microsoft YaHei;
                    font-weight: bold;
                    color: #66d6ff;
                    display: flex;
                    align-items: center;
                }
                .row1 {
                    font-size: 14px;
                    font-family: SimHei;
                    font-weight: 400;
                    color: #82a5fe;
                    margin-top: 9px;
                }
                .goNext {
                    width: 20px;
                    height: 20px;
                    margin-left: 7px;
                }
            }
            .right {
                width: 62px;
                height: 62px;
            }
        }
    }
}
</style>
